From: Fabian Grünbichler Date: Wed, 23 Apr 2025 16:18:51 +0000 (+0200) Subject: [PATCH 2/2] control: make Multi-Arch configurable X-Git-Tag: archive/raspbian/2.7.11-2+rpi1^2^2~1 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/%22bookmarks:/?a=commitdiff_plain;h=025b03a2336e6c6db85a3720c2c7c68a714eb25f;p=rust-debcargo.git [PATCH 2/2] control: make Multi-Arch configurable to allow overriding if needed, without the need to override all of debian/control. Signed-off-by: Fabian Grünbichler Gbp-Pq: Name 0002-control-make-Multi-Arch-configurable.patch --- diff --git a/debcargo.toml.example b/debcargo.toml.example index 862b6c2..da55db0 100644 --- a/debcargo.toml.example +++ b/debcargo.toml.example @@ -196,6 +196,10 @@ uploaders = [ "foo bar " ] #PLACEHOLDER #""" +# Value for the Multi-Arch field of the package. If omitted, debcargo will +# automatically set no value for 'bin', and 'same' for all 'lib' packages. +#multi_arch = "no|same|foreign|allowed" + # Additional Depends on top of the ones generated by debcargo. This should be # used to pull in system libraries for crates that need them to build. You'll # want the -dev versions of the library packages, since our crate packages are diff --git a/src/config.rs b/src/config.rs index 773d739..f445e53 100644 --- a/src/config.rs +++ b/src/config.rs @@ -76,6 +76,7 @@ pub struct PackageOverride { section: Option, summary: Option, description: Option, + multi_arch: Option, depends: Option>, recommends: Option>, suggests: Option>, @@ -219,6 +220,10 @@ impl Config { self.with_package(key, |pkg| pkg.description.as_deref()) } + pub fn package_multi_arch(&self, key: PackageKey) -> Option<&str> { + self.with_package(key, |pkg| pkg.multi_arch.as_deref()) + } + pub fn package_depends(&self, key: PackageKey) -> Option<&Vec> { self.with_package(key, |pkg| pkg.depends.as_ref()) } diff --git a/src/debian/control.rs b/src/debian/control.rs index be745e7..eb46d81 100644 --- a/src/debian/control.rs +++ b/src/debian/control.rs @@ -589,6 +589,9 @@ impl Package { .flatten() .map(|s| s.to_string()), ); + if let Some(multi_arch) = config.package_multi_arch(key) { + self.multi_arch = Some(multi_arch.to_owned()); + } } }